<div class="right_side_operate_area">
	<?php  
		$user=$session->read('User');
		if($showpage==1) {
			if(isset($paging)){ echo $this->renderElement('pagination',$paging);} 
		}
	?>
	<div class="right search_box">
		<form onsubmit="return searchtech()">
	    	<div class="left search_text">
	    		<?php echo $form->text('talent.keyword',array('placeholder'=>'搜索科技项目名称','value'=>$keyword, 'id'=>'talentkey', 'class'=>'text_box'));?>
	    	</div>
	        <div class="left search_btn"><input type="submit" value=""/></div>
        </form>
    </div>
    <div class="right search_box">
		<form onsubmit="return searchtech()">
	    	<div class="left search_text">
	    		<?php echo $form->text('company.keyword',array('placeholder'=>'搜索企业名称','value'=>$enterprise, 'id'=>'search', 'class'=>'text_box'));?>
	    	</div>
	        <div class="left search_btn"><input type="submit" value=""/></div>
        </form>
        <div class="clear"></div>
    </div>
    <div class="term_choose_area right">
	    <a class="term_choose_btn" id="term_choose_btn" title="选择"></a>
    	<div class="screen_list" id="screen_list" style="display:none;visibility:hidden;">
    		<ul>
    			<?php 
    			foreach($industrys as $key=>$strindustry){
    				$selected="";
    				if($industry==$key){
    					$selected="selected";
    				}
    				echo '<li class="'.$selected.'">';
    				echo $html->link($strindustry,"javascript:void(0)",array("onclick"=>"return setindustry('".$key."')","class"=>$selected));
    				echo '</li>';
    			}
    			?>
    		</ul>
    		<div id="industry" style="display:none"><?php echo $industry?></div>
    	</div>
    </div>
	<div class="right_side_title right">
	 <?php 
	 if($user['isadmin']||$user['isvisitor']){
		$grouplist=array_merge(array(""=>"请选择模块"),$grouplist);
    	echo $form->select('ddlgroup',$grouplist,$group_mod_id, null,null);
	 }
    	?>
    			
    <?php 
		$objyear=$str->getafteryear(1,2008,"请选择申报时间");
    	echo $form->select('ddlyear',$objyear, $year, null,null);
	?>
	<?php 
		$dtypes=array_merge(array(""=>"请选择类型"),$dtypes);
	    echo $form->select('ddltype',$dtypes,$type, null,null);
	?>
	<?php 
	    echo $form->select('ddlgov',$talstacktype,$selecttalstacktype,null,null);
	?>
	
	<?php 
		$states = classregistry::init('Constant')->Technologystatus;
		$objstate=array_merge(array(""=>"请选择立项状态"),$states);
	    echo $form->select('ddlstate',$objstate,$state, null,null);
	?>
	<?php 
		$dstatus=array_merge(array(""=>"请选择申报状态"),$dstatus);
		echo $form->select('ddldstatus',$dstatus, $selectdstatus, null,null);
	?>
	<div id="dstatus" style="display:none"><?php echo $selectdstatus?></div>
	<?php 
			$audit_status = array(""=>"请选择审核状态","0"=>"未审核","1"=>"已审核");
			echo $form->select('ddlaudit',$audit_status, $auditstatus, null,null);
	?>
	</div>
    <div class="clear"></div>
</div>
<div class="right_side_scollbar">
    <div class="detail_info_panel">
        <div class="items_list">
        	<table>
            	<tr>
                    <th>企业名称</th>
                    <th>模块</th>
                    <th>科技项目名称</th>
                    <th>立项类型</th>
                    <th>主管部门</th>
                    <th>申报状态</th>
                    <th>立项状态</th>
                    <th>审核状态</th>
                    <th>申报时间</th>
                </tr>
                <?php 
				foreach($companys as $company){
					$id=$company["SearchCompany"]["id"];
					$company_name=$company["SearchCompany"]["company_name"];
					$showcname=$html->link($str->sub_len($company_name,20),"/companys/showinfosummary/".$id,array("title"=>$company_name),null);
					$objtecs=$company["CompTechnology"];
					$objteccount=count($objtecs);
					
					$groupname=$grouplist[$company["SearchCompany"]["groupid"]];
					
					$i=0;
					if(!empty($objtecs)){
						foreach($objtecs as $technology){
							
							$tecname=$technology["tname"];
							$tecid=$technology["id"];
							echo "<tr class='per_list'>";
							if($i==0){
								echo "<td rowspan='".$objteccount."'>".$showcname."</td>";
							}
							echo "<td>".$groupname."</td>";
							echo "<td>".$html->link($str->sub_len($tecname,20),"/searchs/showtechnology/".$tecid."/".$id."/".$company_name,array("title"=>$tecname))."</td>";
							//$type_id=$technology["type_id"];
							//echo "<td>".classregistry::init('Techstack')->getTName($type_id)."</td>";
							echo "<td>".$str->getkeystr($technology["type_id"],$dtypes)."</td>";
							echo "<td>".$str->getkeystr($technology["department"],$techtype)."</td>";
							echo "<td>".$str->getkeystr($technology["declarate_status"],$dstatus)."</td>";
							$status=$technology["state"];
							$apply_time=$technology["apply_time"];
							$accept_time=$technology["accept_time"];
							$authorize_time=$technology["authorize_time"];
							echo "<td>".$str->getstaus($status)."</td>";
							echo "<td>".$str->getflag($technology["status"])."</td>";
							echo "<td>".$str->getstaustime($status, $apply_time, $accept_time, $authorize_time)."</td>";
							echo "</tr>";
							$i++;
						}
					}
					if($i==0){
						echo "<tr class='per_list'>";
						echo "<td>".$showcname."</td>";
						echo "<td>".$groupname."</td>";
						echo "<td></td><td></td><td></td><td></td><td></td><td></td>";
						echo "</tr>";
					}
				}?>
            </table>
		</div>
    </div>
</div>
<script>
$(document).ready(function() {
	$("#ddlgroup").change(function(){
		searchtech();
		});
	$("#ddlyear").change(function() {  
		searchtech();
	});
	$("#ddltype").change(function() { 
		searchtech();
	});
	$("#ddlgov").change(function() {  
		searchtech();
	});
	$("#ddlaudit").change(function() {  
		searchtech();
	});
	$("#ddldstatus").change(function() { 
	$("#dstatus").html(this.value); 
		searchtech();
	});
	$("#ddlstate").change(function() {  
		searchtech();
	});
});
if($("#talentkey").val()!=""){
	$("#talentkey").focus();
}
if($("#search").val()!=""){
	$("#search").focus();
}
function setindustry(inid){
	$("#industry").html(inid);
	return searchtech();
}
function searchtech()
{	
	var webpath=$("#getpath").attr('href');
	var urlpath=webpath+"searchs/index?seach=all";
	var group=$("#ddlgroup").val();
	var year=$("#ddlyear").val();
	var type=$("#ddltype").val();
	var gov=$("#ddlgov").val();
	var dstatus=$("#dstatus").html();
	var state=$("#ddlstate").val();
	var auditstatus=$("#ddlaudit").val();
	var inid=$("#industry").html();
	var talentkey=$("#talentkey").val();
	var search=$("#search").val();
	if(group=="" && year=="" && type=="" && state=="" && inid=="" && talentkey=="" && gov=="" && dstatus=="" && auditstatus=="" &&search==""){
		location.href=urlpath;
	}else{
		if(group!=""){
			urlpath+="&group="+group;
			}
		if(year!=""){
			urlpath+="&year="+year;
		}
		if(type!=""){
			urlpath+="&type="+type;
		}
		if(gov!=""){
			urlpath+="&gov="+gov;
		}
		if(dstatus!=""){
			urlpath+="&dstatus="+dstatus;
		}
		if(state!=""){
			urlpath+="&states="+state;
		}
		if(auditstatus!=""){
			urlpath+="&auditstatus="+auditstatus;
		}
		if(inid.trim()!=""){
			urlpath+="&industry="+inid.trim();
		}
		if(talentkey.trim()!=""){
			urlpath+="&keyword="+encodeURIComponent(talentkey.trim());
		}
		if(search.trim()!=""){
			urlpath+="&enterprise="+encodeURIComponent(search.trim());
		}
		location.href=urlpath;
	}
	return false;
}
function focuseEV(C,B,A){
	if(window.attachEvent){
		C.attachEvent("on"+B,A);
	}else{
		if(window.addEventListener){
			C.addEventListener(B,A,false);
		}
	}
}
focuseEV(document,"click",function(E){
	var E=E||window.event;
	var A=E.target||E.srcElement;
	var D=window.event?E.button:E.which;
	var C=G("term_choose_btn"),B=G("screen_list");
	while(A&&A!=document.body&&A.tagName.toLowerCase()!="html"){
		if(A==C){break}
		if(A==B){break}
		A=A.parentNode
	}
	if(A==B){
	}else if(A!=C){
		B.style.display="none"
			B.style.visibility="hidden"
	}else{
		if(D<2){
			B.style.display=B.style.display=="block"?"none":"block";
			B.style.visibility=B.style.visibility=="hidden"?"visible":"hidden";
		}
	}
});
funPlaceholder(document.getElementById("talentkey"));
funPlaceholder(document.getElementById("search"));
</script>